﻿// -----------------------------------------------------------------------
// <copyright file="AgeValidation.cs" company="">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace AgeValidator
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows.Controls;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class AgeValidation : ValidationRule
    {

        public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
        {
            int input;
            if(int.TryParse(value.ToString(), out input))
            {
                if (input> 0 && input <101)
                {
                    return new ValidationResult(true, null);
                }
            }
            return new ValidationResult(false, "Not Valid!");
        }
    }
}
